import os
from functools import partial
import itertools
pathStr = r"D:/blwang14/fileTest/part=2020-07-20"
fileName = os.path.basename(pathStr)
import itertools

my_list = [[[1, 2, 3], [4, 5, 6]], [7, 8, 9]]
flattened_list = list(itertools.chain.from_iterable(my_list))

def func(root,value,dir):
    subPath = os.path.join(root,dir)
    va = recTest(subPath)
    res = map(lambda v:value[0]+v,va)
    return res

def recTest(path):
    fileName = os.path.basename(path)
    pname = fileName.split("=")[0]
    pvalue = fileName.split("=")[-1]
    value = [list((pname,pvalue))]
    dirList = os.listdir(path)
    if not dirList:
        return value
    else:
        valueList = map(partial(func,path,value),dirList)
        return  list(itertools.chain.from_iterable(valueList))

print(recTest(pathStr))

from inspect import signature

sig = signature(func)
print(f"sig:{str(sig)}")




